# -*- coding: utf-8 -*-
# @Time    : 2018/12/11 下午6:46
# @Author  : ZhiYuanYang
# @Email   : faryangsh@163.com
# @File    : NewTypeUsage.py

from typing import NewType

# UserId本质上是int类型，所以对 UserId 执行的操作，都要符合int类型 操作
UserId = NewType('UserId', int)


def get_user_name(user_id: UserId) -> str:
    return 'name:' + str(user_id)


if __name__ == '__main__':
    user_a = get_user_name(UserId(42351))
    print(user_a)
    print(UserId(1)+UserId(2))
